import { http } from './request.js';

// 地址相关API
export const addressApi = {
    // 获取地址列表
    getAddresses() {
        return http.get('/user/addresses/list');
    },

    // 添加地址
    addAddress(data) {
        return http.post('/user/addresses', data);
    },

    // 更新地址
    updateAddress(id, data) {
        return http.put(`/user/addresses/${id}`, data);
    },

    // 删除地址
    deleteAddress(id) {
        return http.delete(`/user/addresses/${id}`);
    },

    // 设置默认地址
    setDefaultAddress(id) {
        return http.put(`/user/addresses/${id}/default`);
    },

    // 获取地址详情
    getAddressById(id) {
        return http.get(`/user/addresses/${id}`);
    },

    // 获取默认地址
    getDefaultAddress() {
        return http.get('/user/addresses/default');
    },

    // 分页获取地址
    getAddressPage(params) {
        return http.get('/user/addresses/page', params);
    }
}; 